<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<--
MADE BY ZCH IN 2020.
-->
<script>
function bake(s1,s2,tj){}
function getN(t){
var reg = t.replace(/\d*/,"");
return reg;
}
function getR(t){
var main=t.replace(getN(t),"");
var tempT=getN(t).split("");
for(var j=0;j<22;j++){
if(!(isNaN(tempT[j]))){tempT[j]="*"+tempT[j];}
}
tempT=tempT.toString().replace(/,/g,"");
/////////////////
tempT=tempT.toString().replace(/Ca/g,"+"+40.06);
tempT=tempT.toString().replace(/C/g,"+"+12.01);
tempT=tempT.toString().replace(/H/g,"+"+1.008);
tempT=tempT.toString().replace(/O/g,"+"+16.00);
tempT=tempT.toString().replace(/N/g,"+"+14.01);
tempT=tempT.toString().replace(/P/g,"+"+30.97);
tempT=tempT.toString().replace(/K/g,"+"+39.10);
tempT=tempT.toString().replace(/F/g,"+"+19.00);
tempT=tempT.toString().replace(/\[/g,"(");
tempT=tempT.toString().replace(/\]/g,")");
tempT=tempT.toString().replace(/\(/g,"+(0");
//////////////////
back=tempT;
if(main==0){total=eval(back);}else{total=eval(main+"*(0"+back+")");}
return total;
}
while(1!=2){
name=prompt("请输入要计算摩尔质量的物质");
alert(name+"的相对分子质量为"+getR(name));
}
</script>